import Vue from 'vue'
import Router from 'vue-router'
// import store from '../store/index.js'
const _import = require('./_import_' + process.env.NODE_ENV)

Vue.use(Router)

import Layout from '../views/layout/Layout'
var power = localStorage.getItem('power')
var ishidden = false

export const constantRouterMap = [

  { path: '/login', component: _import('login/index'), hidden: true },
  { path: '/404', component: _import('404'), hidden: true },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path: '/home',
    component: Layout,
    name: 'home',
    meta: { roles: ['admin'] },
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/dashboard/index'),
        meta: { title: '后台管理', icon: 'dashboard' }
      }
    ]
  },

  // {
  //   path: '/tab',
  //   name: 'tab',
  //   hidden: false,
  //   component: Layout,
  //   meta: { icon: 'example' },
  //   children: [
  //     {
  //       path: 'Tabs',
  //       name: 'Tabs',
  //       component: () => import('@/views/tab/index'),
  //       meta: { title: 'Tabs', icon: 'tab' }
  //     }
  //   ]
  // },
  {
    path: '/password',
    component: Layout,
    name: 'password',
    meta: { roles: ['admin'] },
    children: [
      {
        path: 'password',
        name: 'password',
        component: () => import('@/views/table/index'),
        meta: { title: '修改密码', icon: 'password' }
      }
    ]
  }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export const asyncRouterMap = [

  // {
  //   path: '/excel',
  //   component: Layout,
  //   redirect: '/excel/exportExcel',
  //   name: 'excels',
  //   meta: {
  //     title: 'excel',
  //     icon: 'excel',
  //     pwoer:3,

  //   },
  //   children: [
  //     {
  //       path: 'exportExcel',
  //       name: 'exportExcelw',
  //       component: () => import('@/views/excel/exportExcel'),
  //       meta: { title: 'exportExcel', icon: 'excel',power:3 }
  //     }
  //   ]
  // },

  {
    path: '/resume',
    component: Layout,
    redirect: '/resume/resume',
    name: 'resume',
    hidden: false,
    meta: { title: '简历管理', icon: 'excel' },
    children: [
      {
        path: 'resume',
        name: 'res',
        component: () => import('@/views/resume/resume'),
        meta: { title: '简历中心' }
      },
      {
        path: 'haspass',
        name: 'haspass',
        component: () => import('@/views/resume/haspass'),
        meta: { title: '已通过简历' }
      }
    ]
  },

  // 表单
  {
    path: '/form',
    component: Layout,
    redirect: '/table/partment',
    name: 'form',
    hidden: false,
    meta: {
      title: '部门管理',
      icon: 'tree',
      roles: ['admin']
    },
    children: [
      {
        path: 'partment',
        name: 'partment',
        component: () => import('@/views/form/partment'),
        meta: { title: '添加部门', roles: ['admin'] }
      },
      {
        path: 'adduser',
        name: 'adduser',
        component: () => import('@/views/form/adduser'),
        meta: { title: '添加用户', roles: ['admin'] }
      },
      {
        path: 'manger',
        name: 'manger',
        component: () => import('@/views/form/partmentMange'),
        meta: { title: '部门人员', roles: ['admin'] }
      }
    ]
  },
  {
    path: '/tmp',
    name: 'updateTmp',
    component: Layout,
    hidden: false,
    meta: { icon: 'form' },
    children: [
      {
        path: 'tmp',
        name: 'tmp',
        component: () => import('@/views/form/updateTmp'),
        meta: { title: '通知模版', icon: 'form' }
      }
    ]
  },

  {
    path: '/school',
    name: 'addschool',
    component: Layout,

    meta: { icon: 'example' },
    children: [
      {
        path: 'school',
        name: 'school',
        component: () => import('@/views/form/school'),
        meta: { title: '学校管理', icon: 'tab' }
      }
    ]
  },
  {
    path: '/time',
    name: 'updatetime',
    component: Layout,
    hidden: false,
    meta: { icon: 'icon' },
    children: [
      {
        path: 'time',
        name: 'time',
        component: () => import('@/views/table/time'),
        meta: { title: '过期天数', icon: 'icon' }
      }
    ]
  }

]
